from web.page.page import WebPage

from web.locator.locator import indexSerarchLocator
from web.page.page_element import PageElement
import random

class IndexSearchPage(WebPage):
    url = 'http://huicewang.com/ecshop/index.php'  # 参数化--可以写在文件中的

    category = PageElement(**indexSerarchLocator.category_loc)
    keyword = PageElement(**indexSerarchLocator.keyword_loc)
    search = PageElement(**indexSerarchLocator.search_loc)

    def serarchData(self,category ,keyword):
        self.category.select_by_index(9)
        self.keyword.send_keys(keyword)
        self.search.click()

if __name__ == '__main__':
    search = IndexSearchPage()
    search.open()
    search.serarchData('GSM手机','三星')
